
cd "/Users/eliemurard/Dropbox/WorldBank Refugee project/World Dev revision/replication/"


* Table 2: Political preferences, trust, and civic engagement among second-generation refugees and Greek natives

use ESS_natref,clear 




	global dependent   ppltrst pplfair pplhlp   trstprl trstlgl trstplc trstplt  /// /* TRUST */
					   prtvtgr_1 prtvtgr_2 prtvtgr_3 prtvtgr_4 lrscale /// /* Political preferences */
					   gincdif  ipeqopt  iphlppl    ipudrst  ipstrgv /// /* Political values */
					   vote  polintr_3  active_poli part_nonvol_2   	/// /*  civic engagement
					 discrimation langua_grec 										/// /* other outcomes
			 
			
	global option varlabels tex plain fragment bdec(3) se starloc(1) starlevels(10 5 1) nocenter  noautosumm  
	global option_av varlabels tex plain fragment bdec(3) se nocenter nostar  noautosumm  
	
		
	foreach y of varlist  $dependent {
	qui su `y' if group==1 
	g Z_`y' = (`y'-r(mean))/r(sd)
	
	local l: variable label `y'
	label var Z_`y'  "`l'" 
	
	}

	
	
	local j=1
	foreach y in $dependent    {
	
		local l: variable label `y'
		outreg,clear(b`j') 
		cap drop x
		g x= group==1
		label var x  "`l'"
		qui reg  `y' x    if x==1   ,nocons 
		outreg, merge(b`j')  ${option_av} nod  keep(x) ctitle( "", "natives") addrows("","" ) 
		cap drop x
		g x= group==2
		label var x  "`l'"
		qui reg  `y' x     if x==1  ,nocons 
		outreg, merge(b`j')  ${option_av} nod keep(x) ctitle( "", "refugees")
		
		cap drop x
		g x= group==2
		label var x  "`l'"
		qui reg  `y' x    if inlist(group,1,2)  
		outreg, merge(b`j')  ${option}  keep(x) nod  ctitle( "", "(2)-(1)")
		
		
		cap drop x
		g x= group==2
		label var x  "`l'"
		qui reg  Z_`y' x   if inlist(group,1,2)
		outreg, merge(b`j')  ${option}  keep(x) nod  ctitle( "", "Z-score") 
	
		cap drop x
		g x= group==2
		label var x  "`l'"
		qui reg  `y' x male i.yrbrn i.year  if inlist(group,1,2)  
		outreg, merge(b`j')  ${option}  keep(x) nod  ctitle( "", "age-sex")
		
		cap drop x
		g x= group==2
		label var x  "`l'"
		qui reg  `y' x male  eduyrs  farmer  skilledoccu  i.yrbrn i.year  if inlist(group,1,2) 
		outreg, merge(b`j')  ${option}  keep(x) nod  ctitle( "", "edu-occu")
		
	
			
	
	local j=`j'+1
	}
	*
	
	local k=1
	foreach y in $dependent    {
		
		if `k'==1 {
		qui  outreg , replace store(main) replay(b`k')  ${option} 
		}
		else{
		 qui outreg, replay(main) append(b`k')   ${option} 
		}
		local k=`k'+1
		}
	
	 outreg  , replace replay(main)    ${option} 
	
